import { reactive, onMounted, onUnmounted } from 'vue'

// 获取滚动条位置
function getScroll_position() {
    const movement = reactive({
        scroll_move(e) {
            movement.y = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
        }
    });

    onMounted(() => {
        window.addEventListener("scroll", movement.scroll_move)
    })

    onUnmounted(() => {
        window.removeEventListener("scroll", movement.scroll_move)
    })

    return movement;
}

export { getScroll_position };